<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:sec="http://www.springframework.org/security/tags">
    <h:form prependId="false">
        <div id="menuBar">
            <p:menubar autoSubmenuDisplay="true" rendered="#{request.userPrincipal != null}" >
                <p:menuitem value="#{msgs['campo.empresa']}" action="/pages/empresa?faces-redirect=true" ajax="false" rendered="#{request.userPrincipal.principal.permissoes.contains('ROLE_ADMIN')}" />
                <p:menuitem value="#{msgs['campo.usuario']}" action="/pages/usuario?faces-redirect=true" ajax="false" rendered="#{request.userPrincipal.principal.permissoes.contains('ROLE_ADMIN')}" />
                <p:menuitem value="#{msgs['campo.produto']}" action="/pages/produto?faces-redirect=true" ajax="false" rendered="#{request.userPrincipal.principal.permissoes.contains('ROLE_ADMIN')}" />
                <p:menuitem value="#{msgs['campo.leilao']}" action="/pages/leilao?faces-redirect=true" ajax="false" />
                <p:menuitem value="#{msgs['campo.ganhador']}" action="/pages/ganhador?faces-redirect=true" ajax="false"  />
            </p:menubar>
        </div>
        <div id="loginBar" rendered="#{request.userPrincipal != null}">
            <div id="logoutButton" onclick="document.location.href = '#{request.contextPath}/j_spring_security_logout'">
                <h:outputText id="Sair" value="#{msgs['menu.logoff']}"/>
            </div>
            <h:panelGroup id="userButton" layout="block" rendered="#{request.userPrincipal != null}">
                <h:outputText id="nomeUsuario" value="#{request.userPrincipal.principal.nome.toLowerCase()}" /> 
            </h:panelGroup>
        </div>
    </h:form>
</ui:composition>
